<div class="row">
  <div class="col-xs-12">
    <%= render partial: 'common/nav', locals: {show_tab: :show, model_nav_name: :admin_user, pjax: false} %>
    <div class="form-horizontal form-show" id="admin_user">
          <div class="form-group">
            <label class="control-label col-xs-12 col-sm-3"><%= t 'activerecord.attributes.user.name' %></label>
            <div class="col-xs-12 col-sm-9">
              <div class="clearfix">
                    <input type="text" readonly="readonly" class="col-xs-12 col-sm-6" value="<%= @user.name %>">
              </div>
            </div>
          </div>
          <div class="form-group">
            <label class="control-label col-xs-12 col-sm-3"><%= t 'activerecord.attributes.user.email' %></label>
            <div class="col-xs-12 col-sm-9">
              <div class="clearfix">
                    <input type="text" readonly="readonly" class="col-xs-12 col-sm-6" value="<%= @user.email %>">
              </div>
            </div>
          </div>
          <div class="form-group">
            <label class="control-label col-xs-12 col-sm-3"><%= t 'activerecord.attributes.user.phone' %></label>
            <div class="col-xs-12 col-sm-9">
              <div class="clearfix">
                    <input type="text" readonly="readonly" class="col-xs-12 col-sm-6" value="<%= @user.phone %>">
              </div>
            </div>
          </div>
          <div class="form-group">
            <label class="control-label col-xs-12 col-sm-3"><%= t 'activerecord.attributes.user.organization' %></label>
            <div class="col-xs-12 col-sm-9">
              <div class="clearfix">
                    <input type="text" readonly="readonly" class="col-xs-12 col-sm-6" value="<%= @user.organization.name if @user.organization.present? %>">
              </div>
            </div>
          </div>
          <div class="form-group">
            <label class="control-label col-xs-12 col-sm-3"><%= t 'activerecord.attributes.user.remark' %></label>
            <div class="col-xs-12 col-sm-9">
              <div class="clearfix">
                    <textarea readonly="readonly" class="col-xs-12 col-sm-6"><%= @user.remark %></textarea>
              </div>
            </div>
          </div>
    </div>
  </div>
</div>
<div class="base-border">
  <label class="base-border-after"><%= t 'activerecord.attributes.user.roles' %></label>
  <% if @user.roles.present? #用户角色 %>
      <table class="table table-striped table-hover">
        <thead>
        <tr>
          <td><%= t 'activerecord.attributes.defaults.id' %></td>
          <td><%= t 'activerecord.attributes.role.name' %></td>
          <td><%= t 'activerecord.attributes.role.description' %></td>
        </tr>
        </thead>
        <tbody>
        <% @user.roles.each do |role| %>
            <tr>
              <td><%= role.id %></td>
              <td><%= role.name %></td>
              <td><%= role.description %></td>
            </tr>
        <% end %>
        </tbody>
      </table>
  <% else %>
      暂无角色
  <% end %>
</div>

<script>
    $(function () {
        $('.nav.nav-list li.active').removeClass('active');
        $('.nav.nav-list li[data-model="user_list"]').addClass('active');
    } );
</script>